package cn.fl.mcr.transform;

import cn.lionbridgecapital.loan.model.dto.McrWriteOffConfirmDetailDTO;
import cn.lionbridgecapital.loan.model.vo.McrWriteOffConfirmDetailVO;
import cn.cmm.base.framework.utils.CollectionUtils;
import java.util.ArrayList;
import java.util.List;



 /**
 * @Description: 核销确认明细 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrWriteOffConfirmDetailVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrWriteOffConfirmDetailDTO
	 * @return McrWriteOffConfirmDetailVO
	 */
	public static McrWriteOffConfirmDetailVO toVO(McrWriteOffConfirmDetailDTO dto) {
		McrWriteOffConfirmDetailVO vo = null;
		if (dto != null) { 
			vo = new McrWriteOffConfirmDetailVO();
			vo.setId(dto.getId());
			vo.setBatNo(dto.getBatNo());//批次号
			vo.setPactNo(dto.getPactNo());//合同号
			vo.setPerdNo(dto.getPerdNo());//还款期次号
			vo.setCstNm(dto.getCstNm());//客户姓名
			vo.setRepayType(dto.getRepayType());//实收类型
			vo.setRepayDate(dto.getRepayDate());//实收时间
			vo.setRepayAmt(dto.getRepayAmt());//实收金额
			vo.setRepayPrincipal(dto.getRepayPrincipal());//实收本金
			vo.setRepayInterest(dto.getRepayInterest());//实收利息
			vo.setRepayPenaltyInterest(dto.getRepayPenaltyInterest());//实收罚息

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrWriteOffConfirmDetailVO
	 * @return McrWriteOffConfirmDetailDTO
	 */
	public static McrWriteOffConfirmDetailDTO toDTO(McrWriteOffConfirmDetailVO vo) {
		McrWriteOffConfirmDetailDTO dto = null;
		if (vo != null) {
			dto = new McrWriteOffConfirmDetailDTO();
			dto.setId(vo.getId());
			dto.setBatNo(vo.getBatNo());//批次号
			dto.setPactNo(vo.getPactNo());//合同号
			dto.setPerdNo(vo.getPerdNo());//还款期次号
			dto.setCstNm(vo.getCstNm());//客户姓名
			dto.setRepayType(vo.getRepayType());//实收类型
			dto.setRepayDate(vo.getRepayDate());//实收时间
			dto.setRepayAmt(vo.getRepayAmt());//实收金额
			dto.setRepayPrincipal(vo.getRepayPrincipal());//实收本金
			dto.setRepayInterest(vo.getRepayInterest());//实收利息
			dto.setRepayPenaltyInterest(vo.getRepayPenaltyInterest());//实收罚息

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<McrWriteOffConfirmDetailDTO>
	 * @return List<McrWriteOffConfirmDetailVO>
	 */
	public static List<McrWriteOffConfirmDetailVO> toVOList(List<McrWriteOffConfirmDetailDTO> list) {
		List<McrWriteOffConfirmDetailVO>  voList = new ArrayList<McrWriteOffConfirmDetailVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrWriteOffConfirmDetailDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrWriteOffConfirmDetailVO>
	 * @return List<McrWriteOffConfirmDetailDTO>
	 */
	public static List<McrWriteOffConfirmDetailDTO> toDTOList(List<McrWriteOffConfirmDetailVO> list) {
		List<McrWriteOffConfirmDetailDTO>  dtoList = new ArrayList<McrWriteOffConfirmDetailDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrWriteOffConfirmDetailVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
